﻿<!--#include file="const.asp"-->
<%
'====================================================================
' 感谢使用晴天3G智能建站系统..
' 作者:梁永强.QQ:766750857
' 官方网址:wap.qt3g.com
' 声明:软件版权归作者所有,没有经过作者本人同意不得非法破解和传播本程序
'====================================================================
%>


<%
if sid="Null" then
	Response.Redirect "login.asp"
	Response.end
end if
IF  Request.QueryString("Action")="login" Then
	call login
else
	call index
end if
end Function



Function index
	dim rs,sql,Runtxt,id
	Runtxt=qingtian.RunStr
    		id = Request("id")    
    		If id = "" Then id = 1
   		If Not IsNumeric(id) Then id = 1
    		id = CLng(id)
    		If id < 1 Then id = 1

%>
	<card title="编辑用户"><p align="left">
<%
		set rs=Server.CreateObject("ADODB.Recordset")
		Sql = "select top 1 *  FROM qingtian_user where id="&id&""
		rs.open sql,conn,1,1
		if not (rs.eof and rs.bof) then
%>

	用户名：<br/>
	<input emptyok="true"  name="user<%=Runtxt%>" maxlength="50" value="<%=qingtian.FormatEdit(rs("user"))%>" type="text"/><br/>
	用户昵称：<br/>
	<input emptyok="true"  name="name<%=Runtxt%>" maxlength="50" value="<%=qingtian.FormatEdit(rs("name"))%>" type="text"/><br/>
	用户密码：<br/>
	<input emptyok="true"  name="pass<%=Runtxt%>" maxlength="50" value="留空为不更改" type="text"/><br/>
	<%=qingtian.bit%>：<br/>
	<input emptyok="true"  name="money1<%=Runtxt%>" maxlength="50" value="<%=qingtian.FormatEdit(rs("money1"))%>" type="text"/><br/>
	<%=qingtian.bi%>：<br/>
	<input emptyok="true"  name="money<%=Runtxt%>" maxlength="50" value="<%=qingtian.FormatEdit(rs("money"))%>" type="text"/><br/>
	魅力值：<br/>
	<input emptyok="true"  name="meili<%=Runtxt%>" maxlength="50" value="<%=qingtian.FormatEdit(rs("meili"))%>" type="text"/><br/>
	体力值：<br/>
	<input emptyok="true"  name="tili<%=Runtxt%>" maxlength="50" value="<%=qingtian.FormatEdit(rs("tili"))%>" type="text"/><br/>
	人气值：<br/>
	<input emptyok="true"  name="renqi<%=Runtxt%>" maxlength="50" value="<%=qingtian.FormatEdit(rs("renqi"))%>" type="text"/><br/>
	年龄：<br/>
	<input emptyok="true"  name="nianlin<%=Runtxt%>" maxlength="50" value="<%=qingtian.FormatEdit(rs("nianlin"))%>" type="text"/><br/>
	地区：<br/>
	<input emptyok="true"  name="diqu<%=Runtxt%>" maxlength="50" value="<%=qingtian.FormatEdit(rs("diqu"))%>" type="text"/><br/>
	积分：<br/>
	<input emptyok="true"  name="zf<%=Runtxt%>" maxlength="50" value="<%=qingtian.FormatEdit(rs("zf"))%>" type="text"/><br/>
	签名：<br/>
	<input emptyok="true"  name="mark<%=Runtxt%>" value="<%=qingtian.FormatEdit(rs("mark"))%>" type="text"/><br/>
	Q Q：<br/>
	<input emptyok="true"  name="qq<%=Runtxt%>" maxlength="50" value="<%=qingtian.FormatEdit(rs("qq"))%>" type="text"/><br/>
	邮箱：<br/>
	<input emptyok="true"  name="mail<%=Runtxt%>" maxlength="50" value="<%=qingtian.FormatEdit(rs("mail"))%>" type="text"/><br/>
	手机号码：<br/>
	<input emptyok="true"  name="mobile<%=Runtxt%>" maxlength="11" value="<%=qingtian.FormatEdit(rs("mobile"))%>" type="text"/><br/>
        性别:<select name='xingbie' value='<%=rs("xingbie")%>'><option value='男'>男</option><option value='女'>女</option></select><br/>
        开通空间:<select name='kongjian' value='<%=rs("kongjian")%>'><option value='0'>否</option><option value='1'>是</option></select><br/>
        设为站长:<select name='bbs' value='<%=rs("bbs")%>'><option value='false'>否</option><option value='true'>是</option></select><br/>
        禁止登录:<select name='nologin' value='<%=rs("nologin")%>'><option value='false'>否</option><option value='true'>是</option></select><br/>
        禁止发帖:<select name='noall' value='<%=rs("noall")%>'><option value='false'>否</option><option value='true'>是</option></select><br/>
        禁止回复:<select name='noadd' value='<%=rs("noadd")%>'><option value='false'>否</option><option value='true'>是</option></select><br/>
        禁止上传文件:<select name='nofile' value='<%=rs("nofile")%>'><option value='false'>否</option><option value='true'>是</option></select><br/>
	<anchor>确定提交
    	<go href="edituser.asp?Action=login&amp;id=<%=id%>&amp;sid=<%=sid%>" method='post'>
        <postfield name="user" value="$(user<%=Runtxt%>)"/>
        <postfield name="name" value="$(name<%=Runtxt%>)"/>
        <postfield name="pass" value="$(pass<%=Runtxt%>)"/>
        <postfield name="money1" value="$(money1<%=Runtxt%>)"/>
        <postfield name="money" value="$(money<%=Runtxt%>)"/>
        <postfield name="meili" value="$(meili<%=Runtxt%>)"/>
        <postfield name="tili" value="$(tili<%=Runtxt%>)"/>
        <postfield name="renqi" value="$(renqi<%=Runtxt%>)"/>
        <postfield name="nianlin" value="$(nianlin<%=Runtxt%>)"/>
        <postfield name="diqu" value="$(diqu<%=Runtxt%>)"/>
        <postfield name="zf" value="$(zf<%=Runtxt%>)"/>
        <postfield name="mark" value="$(mark<%=Runtxt%>)"/>
        <postfield name="qq" value="$(qq<%=Runtxt%>)"/>
        <postfield name="mail" value="$(mail<%=Runtxt%>)"/>
        <postfield name="mobile" value="$(mobile<%=Runtxt%>)"/>
        <postfield name="kongjian" value="$(kongjian)"/>
        <postfield name="bbs" value="$(bbs)"/>
        <postfield name="nologin" value="$(nologin)"/>
        <postfield name="noadd" value="$(noadd)"/>
        <postfield name="noall" value="$(noall)"/>
        <postfield name="nofile" value="$(nofile)"/>
        <postfield name="xingbie" value="$(xingbie)"/>
    	</go>
	</anchor><br/>
<%              else
                Response.Write("出错了！没有该用户！")
		end if
		rs.Close
		Set rs = Nothing
%>

-------------<br/>
<a href='user.asp?sid=<%=sid%>'>返回用户管理</a><br/>
<a href='index.asp?sid=<%=sid%>'>后台管理首页</a><br/>
<%
End Function


Function login

		dim rs,sql,errs,id,name,pass,user,mail,mobile,mark,qq,meili,tili,renqi,diqu,nianlin,zf,kongjian,bbs,nologin,noall,nofile,money,money1,xingbie,noadd

		name=Replace(Request.form("name"),"'","''")
		pass=Replace(Request.form("pass"),"'","''")
		user=Replace(Request.form("user"),"'","''")
		mail=Replace(Request.form("mail"),"'","''")
		mobile=Replace(Request.form("mobile"),"'","''")
		mark=Replace(Request.form("mark"),"'","''")
		qq=Replace(Request.form("qq"),"'","''")
		meili=Replace(Request.form("meili"),"'","''")
		tili=Replace(Request.form("tili"),"'","''")
		renqi=Replace(Request.form("renqi"),"'","''")
		diqu=Replace(Request.form("diqu"),"'","''")
		nianlin=Replace(Request.form("nianlin"),"'","''")
		zf=Replace(Request.form("zf"),"'","''")
		kongjian=Replace(Request.form("kongjian"),"'","''")
		bbs=Replace(Request.form("bbs"),"'","''")
		nologin=Replace(Request.form("nologin"),"'","''")
		noall=Replace(Request.form("noall"),"'","''")
		noadd=Replace(Request.form("noadd"),"'","''")
		nofile=Replace(Request.form("nofile"),"'","''")
		money=Replace(Request.form("money"),"'","''")
		money1=Replace(Request.form("money1"),"'","''")
		xingbie=Replace(Request.form("xingbie"),"'","''")

    		id = Request("id")    
    		If id = "" Then id = 1
   		If Not IsNumeric(id) Then id = 1
    		id = CLng(id)
    		If id < 1 Then id = 1

		errs=""
		if name="" or user="" or mobile="" or mark="" or meili="" or tili="" or renqi="" or diqu="" or nianlin="" or zf="" or kongjian="" or bbs="" or nologin="" or noall="" or nofile="" or money="" or money1="" then errs=errs & "关键字不能为空！<br/>"
	%>
	<card id="login" title="编辑用户" ontimer="user.asp?sid=<%=sid%>"><timer value="20"/>
		<p align="left">
	<%
	IF len(errs)=0 then

                if pass="" or pass="留空为不更改" then
		set rs=Server.CreateObject("ADODB.Recordset")
		Sql = "select top 1 *  FROM qingtian_user where id="&id&""
		rs.open sql,conn,1,3
		if not (rs.eof and rs.bof) then
		rs("name")=name
		rs("user")=user
		rs("mail")=mail
		rs("mobile")=mobile
		rs("mark")=mark
		rs("qq")=qq
		rs("meili")=meili
		rs("tili")=tili
		rs("renqi")=renqi
		rs("diqu")=diqu
		rs("nianlin")=nianlin
		rs("zf")=zf
		rs("kongjian")=kongjian
		rs("bbs")=bbs
		rs("nologin")=nologin
		rs("noall")=noall
		rs("noadd")=noadd
		rs("nofile")=nofile
		rs("money")=money
		rs("money1")=money1
		rs("xingbie")=xingbie
		rs.update()
		end if
		rs.Close
		Set rs = Nothing
                else
		set rs=Server.CreateObject("ADODB.Recordset")
		Sql = "select top 1 *  FROM qingtian_user where id="&id&""
		rs.open sql,conn,1,3
		if not (rs.eof and rs.bof) then
		rs("name")=name
		rs("pass")=md5(pass)
		rs("user")=user
		rs("mail")=mail
		rs("mobile")=mobile
		rs("mark")=mark
		rs("qq")=qq
		rs("meili")=meili
		rs("tili")=tili
		rs("renqi")=renqi
		rs("diqu")=diqu
		rs("nianlin")=nianlin
		rs("zf")=zf
		rs("kongjian")=kongjian
		rs("bbs")=bbs
		rs("nologin")=nologin
		rs("noall")=noall
		rs("noadd")=noadd
		rs("nofile")=nofile
		rs("money")=money
		rs("money1")=money1
		rs("xingbie")=xingbie
		rs.update()
		end if
		rs.Close
		Set rs = Nothing
                end if
		%>编辑用户成功!<br/><%

	else%>
		<%=errs%>

		<a href="edituser.asp?id=<%=id%>&amp;sid=<%=sid%>">返回修改</a><br/>
<%	end if
%>
<a href='user.asp?sid=<%=sid%>'>返回用户管理</a><br/>
<a href='index.asp?sid=<%=sid%>'>后台管理首页</a><br/>
<%
end Function 


%>
